package org.example.intelligent_education.controller;

import org.example.intelligent_education.model.CourseInfo;
import org.example.intelligent_education.model.Result;
import org.example.intelligent_education.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    private AdminService adminService;
    @PostMapping("/addCourse")
    public Result addCourse(String cname, String caname, String tname, String synopsis, BigDecimal price){
        adminService.addCourse(cname, caname, tname, synopsis, price);
        return Result.success("添加成功");
    }

    @RequestMapping("/delCourse")
    public Result delCourse(int cid){
        adminService.delCourse(cid);
        return Result.success("删除成功");
    }

}
